package com.bit.ioc.controller;

import com.bit.ioc.config.UserConfig;
import com.bit.ioc.model.UserInfo;
import com.bit.ioc.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@ResponseBody
@Controller
public class UserController {

    @Autowired
    private UserService us;

//    @Autowired
//    @Qualifier("user2")
    @Resource(name = "user1")
    private UserInfo user2;


//    @Autowired
//    private ApplicationContext context;

    public void sayHi(){
        us.doService();
        System.out.println(user2);
        System.out.println("UserController.sayHi....");
    }

    @RequestMapping("/hello")
    public String hello(){

        return "hello";
    }

}
